package org.dromara.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description //学校性质枚举类
 * @Date 2023/8/21 10:47
 * @Author 郭建波
 **/
@AllArgsConstructor
@Getter
public enum SchoolType {
    KINDERGARTEN("0", "幼儿园"),
    PRIMARY_SCHOOL("1", "小学"),
    MIDDLE_SCHOOL("2", "初中"),
    SYSTEM_OF_NINEYEAR("3", "九年制"),
    HIGH_SCHOOL("4", "高中"),
    VOCATIONAL_SCHOOL("5", "职校 "),
    UNIVERSITY("6", "大学"),
    OTHER_SCHOOL("7", "其他");

    private final String code;
    private final String type;

    public String getCode() {
        return code;
    }

    public String getType() {
        return type;
    }

    public static SchoolType getByCode(String code) {
        for (SchoolType e : SchoolType.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null; // 如果没有找到对应的枚举值，返回null
    }


    public static void main(String[] args) {
        SchoolType byCode = SchoolType.getByCode("1");
        System.out.println(byCode.getType());
    }

}
